<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/grsun" prefix="grsun"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<meta name="description" content="Mailbox with some customizations as described in docs" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<%@ include file="/include/main_include.jsp"%>
<%@ include file="/include/form_include.jsp"%>
 
</head>
<body>
	<div class="modal-body" style="max-height: 716px;">
		<div id="divform" class="row mx-dialog-c bs_dialog open"> 
		   <form id="dataForm" class="form-horizontal" method="post"> 
		   <input type="hidden" id="bankId" name="bankId" value="${pd.bankId}"/>   
			<div class="form-group col-lg-6 col-sm-6 col-xs-6">
		        <label class="control-label mx-group-title">银行名称</label>
		        <div class="mx-group-control" style="height:33px;">
					<input id="name" name="name" type="text" class="width-100 mx-input-group" style="height:33px;" value="${pd.name}">
		        </div>
		    </div>
			<div class="form-group col-lg-6 col-sm-6 col-xs-6">
		        <label class="control-label mx-group-title">编码</label>
		        <div class="mx-group-control" style="height:33px;">
					<input id="bankCode" name="bankCode" type="text" class="width-100 mx-input-group" style="height:33px;" value="${pd.bankCode}">
		        </div>
		    </div>
			<div class="form-group col-lg-6 col-sm-6 col-xs-6">
		        <label class="control-label mx-group-title">创建时间</label>
		        <div class="mx-group-control" style="height:33px;">
					<input id="createdate" name="createdate" type="text" class="width-100 mx-input-group" style="height:33px;" value="${pd.createdate}">
		        </div>
		    </div>
		  </form>                  
		</div>
	</div>
	<script type="text/javascript">
	$(function() {
		$('#dataForm').validate({
			submitHandler : function(form) {
				var index = parent.layer.getFrameIndex(window.name);
				$.uitools.showLoading();//打开处理中遮罩层
				$.ajax({
					cache : true,
					type : "POST",
					url : rootpath + '/hhBank/save.do',
					data : $('#dataForm').serialize(),
					error : function(request) {
						$.uitools.hideLoading();//关闭处理中遮罩层
						layer.msg('系统异常！', {
							icon : 2,
							time : 1000
						}, function() {
							parent.layer.close(index);
						})
					},
					success : function(data) {
						$.uitools.hideLoading();//关闭处理中遮罩层
						if (data.code==0) {
							layer.msg('提交成功！', {
								icon : 1,
								time : 1000
							}, function() {
								parent.layer.close(index);
								//刷新列表
								parent.dataTable.datagrid('reload');
							})
						} else {
							layer.msg('提交异常！', {
								icon : 2,
								time : 1000
							}, function() {
								parent.layer.close(index);
							})
						}
					}
				});
			},
			rules : {
				bankId : { required : true },
				name : { required : true },
				bankCode : { required : true },
				createdate : { required : true }
			},
			messages : {
				bankId : { required : '请输入编号' },
				name : { required : '请输入银行名称' },
				bankCode : { required : '请输入编码' },
				createdate : { required : '请输入创建时间' }
			},
			// 失去焦点时不执行验证
			onfocusout : false,
			// 错误提示，错误对象
			errorPlacement : function(error, element) {
				// 1.错误信息，2提示位置，3同时提示多个错误
				layer.tips(error[0].innerText, element, {
					// 错误信息可以同时提示多个，...
					tipsMore : true,
					tips : [ 3, '#D16E6C' ]
				});
			}
		});
	});
	</script>
</body>
</html>
